vec3 grid(vec2 uv){
    vec3 color = vec3(0.);

    vec2 cell = fract(uv);

    if(cell.x < fwidth(cell.x)){
        color=vec3(1.);   
    }
    if(cell.y < fwidth(cell.y)){
        color = vec3(1.);
    }

    if(abs(uv.y)<fwidth(uv.y)){
        color = vec3(0.,1.,0.);
    }
    if(abs(uv.x)<fwidth(uv.x)){
        color = vec3(1.0,0.0,0.);
    }

    return color;
}

void mainImage(out vec4 fragColor,in vec2 fragCoord)
{   
    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = 10.0*(2.0*fragCoord-iResolution.xy)/min(iResolution.x,iResolution.y);

    // Time varying pixel color
    //vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4));
    vec3 color = grid(uv);

    fragColor = vec4(color,1.0);
}